<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>学生考场安排</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description"
	content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
<meta name="author" content="Muhammad Usman">

<!-- The styles -->
<link
	href="<%=request.getContextPath()%>/resources/css/bootstrap-cerulean.min.css"
	rel="stylesheet">
<link
	href="<%=request.getContextPath()%>/resources/css/charisma-app.css"
	rel="stylesheet">
<link
	href='<%=request.getContextPath()%>/resources/bower_components/fullcalendar/dist/fullcalendar.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/fullcalendar/dist/fullcalendar.print.css'
	rel='stylesheet' media='print'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/chosen/chosen.min.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/colorbox/example3/colorbox.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/responsive-tables/responsive-tables.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css'
	rel='stylesheet'>
<link href='<%=request.getContextPath()%>/resources/css/jquery.noty.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/noty_theme_default.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/elfinder.min.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/elfinder.theme.css'
	rel='stylesheet'>
<link
	href='<%=request.getContextPath()%>/resources/css/jquery.iphone.toggle.css'
	rel='stylesheet'>
<link href='<%=request.getContextPath()%>/resources/css/uploadify.css'
	rel='stylesheet'>
<link href='<%=request.getContextPath()%>/resources/css/animate.min.css'
	rel='stylesheet'>

<!-- jQuery -->
<script
	src="<%=request.getContextPath()%>/resources/bower_components/jquery/jquery.min.js"></script>

<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- The fav icon -->
<link rel="shortcut icon"
	href="<%=request.getContextPath()%>/resources/img/favicon.ico">
<link
	href='<%=request.getContextPath()%>/resources/css/datetimepicker.css'
	rel='stylesheet'>
<script
	src="<%=request.getContextPath()%>/resources/js/jquery.datetimepicker.js"></script>
<script type="text/javascript">
	function doPlan(url, smid, sid) {
		$.get(url, {}, function(data) {
			$("#add-testType-form").html(data);
			$("#addTestTypeModal").find("input[name='smid']").val(smid);
			$("#addTestTypeModal").find("input[name='sid']").val(sid);
			$("#addTestTypeModal").modal("show");
		});
	}
	function editPlan(url, smid, sid) {
		$.get(url, {
			smid : smid,
			sid : sid
		}, function(data) {
			$("#edit-testType-form").html(data);
			$("#editTestTypeModal").find("input[name='smid']").val(smid);
			$("#editTestTypeModal").find("input[name='sid']").val(sid);
			$("#editTestTypeModal").modal("show");
		});
	}
	function canclePlan(smid,sid)
	{
		$("#canclePlan").find("input[name='smid']").val(smid);
		$("#canclePlan").find("input[name='sid']").val(sid);
		$("#canclePlan").submit();
	}
</script>
</head>

<body>
	<jsp:include page="../toolbar.jsp"></jsp:include>
	<div class="ch-container">
		<div class="row">
			<jsp:include page="../snav.jsp"></jsp:include>
			<div id="content" class="col-lg-10 col-sm-10">
				<div class="container-fluid">
					<div class="row-fluid">
						<div class="span12">
							<table class="table">
								<thead>
									<tr>
										<th>身份证号</th>
										<th>姓名</th>
										<th>性别</th>
										<th>报考科目</th>
										<th>安排考试</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${users }" var="u">
										<tr>
											<td id="idNumber${u.id }">${u.username}</td>
											<td id="name${u.id }">${u.studentMes.name }</td>
											<td id="sex${u.id }">${u.studentMes.sex }</td>
											<td id="testType${u.id }"><c:if
													test="${!empty u.testType && u.testType!=''}">${u.testType}</c:if>
												<c:if test="${empty u.testType || u.testType==''}">
													<span style="color: red">未预约</span>
												</c:if></td>
											<td><c:if
													test="${!empty u.studentMes.testPlace && u.studentMes.testPlace!=''}">
													<a
														href="javascript:editPlan('<%=request.getContextPath()%>/student/editTestPlace','${u.studentMes.id }','${u.id }')"
														style="color: green">查看</a> | <a
														href="javascript:canclePlan('${u.studentMes.id }','${u.id }')">取消</a>
												</c:if> <c:if
													test="${empty u.studentMes.testPlace || u.studentMes.testPlace==''}">
													<a
														href="javascript:doPlan('<%=request.getContextPath()%>/student/addTestPlace','${u.studentMes.id }','${u.id }')"
														style="color: red">未安排</a>
												</c:if></td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id="addTestTypeModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<form action="<%=request.getContextPath()%>/student/addTestPlace"
					class="form-horizontal" role="form" method="post">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="modal-title">添加考场</h4>
					</div>
					<div class="modal-body">
						<input name="smid" type="hidden" /> <input name="sid"
							type="hidden" />
						<div id="add-testType-form"></div>
						<p>
							<label>考试开始时间*</label> <input name="beginTime"
								class="form-control datetime" />
						</p>
						<p>
							<label>考试开始时间*</label> <input name="endTime"
								class="form-control datetime" />
						</p>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
							<button type="submit" class="btn btn-primary">添加考场</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>

	<div class="modal fade" id="editTestTypeModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<form action="<%=request.getContextPath()%>/student/addTestPlace"
					class="form-horizontal" role="form" method="post">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="modal-title">修改信息</h4>
					</div>
					<div class="modal-body">
						<input name="smid" type="hidden" /> <input name="sid"
							type="hidden" />
						<div id="edit-testType-form"></div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
							<button type="submit" class="btn btn-primary">修改信息</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<form id="canclePlan" style="display: none" method="post" action="<%=request.getContextPath() %>/student/canclePlan">
		<input type="hidden" name="smid" /> <input type="hidden" name="sid" />
	</form>
	<jsp:include page="../foot.jsp"></jsp:include>
</body>
</html>
